< previous page page_561 next page >

Page 561
Examples Filename: ApiTab.frm
In the example shown in Figure 28.3, one tab stop is defined. The left edge of the list box is not considered a tab. Where the state name begins is where the first tab stop is located. To create a tab stop, youll once again call the SendMessage() function:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub Form_Load()
   Dim lngRet As Long

   lngRet = SendMessage(lstStates.hwnd, _
                      LB_SETTABSTOPS, _
                      1, _
                      40&)

   Call StateLoad
End Sub
8160-0561a.gif
Figure 28.3
A single tab stop in a list box.
The SendMessage() function once again receives a window handle from the list box. Next, it needs to be passed the constant LB_SETTABSTOPS to tell the list box to set one or more tab stops. The third parameter is the number of tab stops you want (in this case, one). Finally, you pass the location for the tab stop.
This is where things get a little more complicated. The fourth parameter, this time, uses a unit of measure called dialog units. A dialog unit is the average character width for a given font. To calculate where this will place the tab stop, you can generally divide this number by four. Therefore, the number 40 gives you about 10 average character widths from the left. If you look closely, this just about matches up to the example shown in Figure 28.3.

 
< previous page page_561 next page >

If you like this book, buy it!